package com.action.member;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.controller.Action;
import com.dao.RentalDao;
import com.domain.Rental;

public class AdminRentalFormAction implements Action{
	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HttpSession session = request.getSession();
		if(!session.getAttribute("mem_id").equals("admin")){
			return "/view/member/loginForm.jsp";
		}
		
		List<Rental> rentals = new ArrayList<Rental>();
		RentalDao dao = RentalDao.getInstance();
		rentals = dao.getAdminRental();
		
		request.setAttribute("rentals", rentals);
		return "/view/member/adminRentalForm.jsp";
	}
}
